﻿/*
NTerm: An open source .NET based terminal emulator.
Copyright (C) 2011  Bryan Perris

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NTerm;

namespace NTermConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            NTerminal.Initialize();

            while (true)
            {
                bool exit = false;
                NTerminal.Clear();
                NTerminal.WriteLine("NTerminal Test Console\n");

                NTerminal.WriteLine("Enter a number, then hit ENTER to run the test!");
                NTerminal.WriteLine("Press ENTER after the test finishes to continue\n");
                NTerminal.WriteLine("-1: Exit");
                NTerminal.WriteLine(" 0: Simple text write A");
                NTerminal.WriteLine(" 1: Buffer fill A");
                NTerminal.WriteLine(" 2: Simple scroll A");
                NTerminal.WriteLine(" 3: Formatted string test A");
                NTerminal.WriteLine(" 4: Handled control characters A");
                NTerminal.WriteLine(" 5: Advanced tab positioning A");
                NTerminal.WriteLine(" 6: Simple tabs A");
                NTerminal.WriteLine(" 7: Initialization Exceptions");

                NTerminal.Write("\nTest: ");
                int num = int.Parse(NTerminal.ReadLine());

                NTerminal.Clear();

                switch (num)
                {
                    case -1: exit = true; break;
                    case 0: Tests.SimpleWriteTestA(); break;
                    case 1: Tests.BufferFillTestA(); break;
                    case 2: Tests.SimpleScrollA(); break;
                    case 3: Tests.FormattedStringA(); break;
                    case 4: Tests.ControlCharsA(); break;
                    case 5: Tests.AdvancedTabbingA(); break;
                    case 6: Tests.SimpleTabbingA(); break;
                    case 7: Tests.TestExceptionsA(); break;
                    default: break;
                }

                if (exit)
                    break;

                NTerminal.ReadLine();
            }

            NTerminal.Shutdown();
        }
    }
}
